<template>
  <div style="margin-top:-20px">
    <div style="position:fixed;background:#fff;width:100%;z-index:10">

    </div>
    <el-tabs v-model="activeName" @tab-click="handleClick" >
      <el-tab-pane label="个人认证" name="Authentication_person">
        <authenticationPerson :testFlag="testFlag" />
      </el-tab-pane>
      <!--                <el-tab-pane label="单位认证" name="Authentication_company"></el-tab-pane>-->
      <el-tab-pane label="专家认证" name="Authentication_expert">
        <authenticationExpert :testFlag="testFlag"/>
      </el-tab-pane>
    </el-tabs>
    <!--<router-view style="padding-top:40px"></router-view>-->
  </div>
</template>
<script>
  import authenticationPerson from "./authentication_person";
  import authenticationExpert from "./authentication_expert";
  export default {
    data() {
      return {
        activeName: 'Authentication_person',
        linkId: '',
        personLinkId: '',
        expertLinkId: '',
        linkType: '',
        testFlag: false
      };
    },
    components: {
      authenticationPerson,
      authenticationExpert
    },
    methods: {
      handleClick(tab, event) {
        /*this.$router.push(this.activeName)*/
      }
    },
    mounted() {
      /*this.$router.push(this.activeName)*/
      this.linkId = this.$route.query.linkId;
      this.linkType = this.$route.query.linkType;
      if(this.linkType=="person"){
        this.activeName="Authentication_person";
      } else if(this.linkType=="expert"){
        this.activeName="Authentication_expert";
      }
    },

    created() {
      this.personLinkId = this.$route.query.personLinkId;
      this.expertLinkId = this.$route.query.expertLinkId;
      this.type = this.$route.query.type;
    },

    watch: {
      //监听相同路由下参数变化的时候，从而实现异步刷新
      $route(to, from) {
        this.linkId = this.$route.query.linkId;
        this.linkType = this.$route.query.linkType;
        if(this.linkType=="person"){
          this.activeName="Authentication_person";
        } else if(this.linkType=="expert"){
          this.activeName="Authentication_expert";
        }
        if(!this.linkType){
          this.testFlag = !this.testFlag;
        }
      }
    }
  };
</script>
